package com.richapp.launcher.ui.activities;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;

import com.richapp.launcher.R;

public class RestartTip extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_restarttip);

        AlertDialog.Builder dialog=new AlertDialog.Builder(RestartTip.this);
        dialog.setTitle("温馨提示");
        dialog.setMessage("网络异常修复中60秒后将重启请耐心等待，如自动修复失败请检查您的网络！");
        dialog.setCancelable(true);
        dialog.setPositiveButton("设置网络", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Log.v("点击事件","网络设置");
                finish();
                Intent mIntent = new Intent();
                ComponentName comp = new ComponentName("com.android.settings", "com.android.settings.Settings");
                mIntent.setComponent(comp);
                mIntent.setAction("android.intent.action.VIEW");
                startActivity(mIntent);
            }
        });

        dialog.setNegativeButton("退出", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Log.v("点击事件","退出");
                finish();
                finish();
            }
        });
        dialog.show();
    }

    @Override
    protected void onStop() {
        super.onStop();
        finish();
    }
}
